package com.caishi.lkx.common.oplog;

import lombok.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.Map;

/**
 * @author by keray
 * date:2019/12/4 3:19 PM
 * <p>
 * var duid = userContext.getDuid();
 * var infoId = userContext.currentTokenData().getInfoId();
 * var tokenTime = userContext.currentTokenData().getTime();
 * var role = userContext.currentTokenData().getUserRole();
 * var userType = userContext.currentTokenData().getUserTypeName();
 * var method = req.getMethod();
 */
@Document(collection = "admin_op_log")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Getter
@Setter
public class AdminOpLogModel implements Serializable {

    @Id
    private String id;

    /**
     * 用户id
     */
    @Indexed
    private String userId;


    /**
     * 方法签名
     */
    @Indexed
    private String methodName;


    /**
     * ip
     */
    @Indexed
    private String ip;

    /**
     * url
     */
    @Indexed
    private String url;

    /**
     * 创建时间
     */
    @Indexed
    private long createdTime;

    /**
     * 设备id
     */
    private String duid;
    /**
     * 登录id
     */
    private String infoId;
    /**
     * token创建时间戳
     */
    private Long tokenTime;
    /**
     * token角色
     */
    private String role;
    /**
     * token用户类型
     */
    private String userType;
    /**
     * 请求方法
     */
    private String reqMethod;

    private Map<String, Object> result;

    private Map<String, Object> args;
}
